import Taro, { Component } from '@tarojs/taro'
import { View, Button, Image } from '@tarojs/components'
import './tabTop.less'


class TabTop extends Component {

    constructor() {
        super()
        this.state = {
            left: '<',
            center: ''
        }
    }

    componentWillReceiveProps(nextProps) {
        console.log(this.props, nextProps)
    }

    componentWillUnmount() { }

    componentDidShow() { }

    componentDidHide() { }

    back(e) {
        Taro.navigateBack(-1)
    }

    render() {
        let { left } = this.state
        return (
            <View className='tabTop'>
                <View className='tabBlock' style={`background:${Taro.getStorageSync('baseColor')}`}>
                    <View className='left' onClick={this.back.bind(this)}>
                        {this.props.back && <Image className='leftImg' src='https://file.open.banchengyun.com/2019/06/19/156091309867425.png'></Image>}
                    </View>
                    <View className='center'>{this.props.title && '个人中心'}</View>
                    <View className='right'></View>
                </View>
            </View>
        )
    }
}

export default TabTop
